package com.quktzhuanka.app.adapter;

import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.quktzhuanka.app.R;
import com.quktzhuanka.app.bean.TaobaoQgBean;

import java.util.List;

public class TaobaoQgAdapter extends BaseQuickAdapter<TaobaoQgBean,BaseViewHolder> {
    public TaobaoQgAdapter(int layoutResId, @Nullable List<TaobaoQgBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, TaobaoQgBean item) {
        //设置图片
        ImageView imageView = holder.getView(R.id.image);
        Glide.with(mContext).load(item.pic_url).placeholder(R.drawable.no_banner).dontAnimate().into(imageView);
        ((TextView)holder.getView(R.id.title_child)).setText(item.title);
        //券后
        holder.setText(R.id.tx2, "抢购价￥" + item.zk_final_price);
        //券后2
        TextView tx2_2 = holder.getView(R.id.tx2_2);
        //设置删除线
        tx2_2.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
        tx2_2.setText("￥"+item.reserve_price);
        ProgressBar progress=holder.getView(R.id.progress);
        progress.setMax(Integer.valueOf(item.total_amount));
        progress.setProgress(Integer.valueOf(item.sold_num));
    }
}
